<?php
/**
 * 岗位搜索
 */

apf_require_controller("HrAbstract");

class Hr_Ajax_SearchPositionController extends HrAbstractController {

    public function handle_request() {
        $params = $this->request->get_parameters();
        $this->format_params($params);

        $kw = trim($params['name']);

        $pos_bll = new Bll_Hr_Position();
        $data = $pos_bll->get_position_by_name($params['function_id'],$kw);
        if(empty($data)){
            $this->json_encode(1,array());
        }
        $status = 1;
        $this->json_encode($status,$data);
    }
    private function format_params($params){
        $status = 0;
        if(empty($params['function_id'])){
            $this->json_encode($status,Const_Tip::ERROR_PARAM);
        }
        if(empty($params['name'])){
            $this->json_encode($status,Const_Tip::ERROR_PARAM);
        }
    }
}